﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class LocationGoodsUIRule
    {
        private static LocationGoodsUIRule _NewInstance = new LocationGoodsUIRule();

        public static LocationGoodsUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new LocationGoodsUIRule();
                }

                return _NewInstance;
            }
        }

        public OutPutParams<bool> SetLocationGoods(string userID, List<LocationGoodsInfo> lstLocationGoods)
        {
            try
            {
                OutPutParams<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<List<LocationGoodsInfo>, OutPutParams<bool>>("SetLocationGoods", new object[] { userID }, lstLocationGoods);

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }
        //分拣货位关联提交  
        public OutPutParams<bool> SetLocationGoodsSort(string userID, List<LocationGoodsInfo> lstLocationGoods)
        {
            try
            {
                OutPutParams<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<List<LocationGoodsInfo>, OutPutParams<bool>>("SetLocationGoodsSort", new object[] { userID }, lstLocationGoods);

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }
        public List<LocationGoodsInfo> GetLocationALLGoods(string goodsCode, string goodsCode3, string locationCode)
        {
            try
            {
                return WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<List<LocationGoodsInfo>>("GetLocationALLGoods", new object[] { goodsCode, goodsCode3, locationCode });


            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }
        public OutPutParams<bool> LocationGoodsMove(string userID, string toLocationCode, List<LocationGoodsInfo> lstLocationGoods)
        {
            try
            {
                OutPutParams<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<List<LocationGoodsInfo>, OutPutParams<bool>>("LocationGoodsMove", new object[] { userID, toLocationCode }, lstLocationGoods);

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public LocationGoodsInfo LocationGoodsInfoByCode(string goodsCode, string goodsCode3)
        {
            try
            {
                return WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<LocationGoodsInfo>("LocationGoodsInfoByCode", new object[] { goodsCode, goodsCode3 });


            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }
        public GoodsAllInfo GetGoodsInfoNeedCollection(string goodsCode)
        {
            try
            {
                return WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<GoodsAllInfo>("GetGoodsInfoNeedCollection", new object[] { goodsCode});


            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }
        public  bool  UpdateGoodsBarCode(List<GoodsAllInfo> lstGoods)
        {
            try
            {
                bool _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<List<GoodsAllInfo>, bool>("UpdateGoodsBarCode", new object[] {}, lstGoods);

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return false;
        }
        public LocationGoodsInfo ExistLoctionGoodsByLocationCode(string code)
        {
            try
            {

                return WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<LocationGoodsInfo>("ExistLoctionGoodsByLocationCode", new object[] { code });
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return null;
            }
        }
        public LocationGoodsInfo ExistLoctionGoodsByGoodsCode(string code)
        {
            try
            {

                return WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<LocationGoodsInfo>("ExistLoctionGoodsByGoodsCode", new object[] { code });
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return null;
            }
        }

        public bool DeleteLoctionGoodsRelation(int locationGoodsId)
        {
            try
            {
                return WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoods>.NewInstance.InvokeWebMethod<bool>("DeleteLoctionGoodsRelation", new object[] { locationGoodsId });

            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return false;
            }
        }

    }
}
